package com.ly.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.ly.pojo.Category;

@Mapper
public interface CategoryMapper {
    // 新增
    @Insert("insert into category(category_name,category_alias,create_user,create_time,update_time)" +
        "values(#{categoryName},#{categoryAlias},#{createUser},#{createTime},#{updateTime})"
    )
    public void add(Category category);
    // 查询列表
    @Select("select * from category where create_user = #{userId}")
    public List<Category> List(Integer userId);
    // 查询详情
    @Select("select * from category where id = #{id}")
    public Category findById(Integer id);
    // 更新数据
    @Update("update category set category_name=#{categoryName},category_alias=#{categoryAlias},update_time=#{updateTime} where id = #{id}")
    public void update(Category category);
    // 删除分类数据
    @Delete("delete from category where id = #{id}")
    public void delete(Integer id);

}
